<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="css/bigpic.css" />
	</head>

	<body>
		<header id="header" class="mui-bar mui-bar-nav" style="background-color: #02C874;">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" style="color: white;"></a>
			<h1 class="mui-title" style="color: white;">图片</h1>
		</header>
		<div class="mui-content">
			<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
				<div class="mui-scroll">
					<div class="mui-content-padded" style="margin: 19px 5px 5px 5px;">
						<ul id="loanlist" class="mui-table-view mui-table-view-chevron">
							
						</ul>
					</div>
				</div>
			</div>
		</div>
		<script src="js/mui.min.js"></script>
		<script src="js/immersed.js"></script>
		<script src="js/mui.zoom.js"></script>
	    <script src="js/mui.previewimage.js"></script>
		<script type="text/javascript">
			mui.init({
				pullRefresh: {
					container: '#pullrefresh',
					up: {
						contentrefresh: '正在加载...',
						callback: pullupRefresh
					}
				}
			});
			mui.previewImage();
			
			mui.plusReady(function() {
				getdata();
			});
			
			var count = 0;
			function pullupRefresh() {
				setTimeout(function() {
					mui('#pullrefresh').pullRefresh().endPullupToRefresh((count <= 0)); //参数为true代表没有更多数据了。
					var table = document.body.querySelector('.mui-table-view');
					var cells = document.body.querySelectorAll('.mui-table-view-cell');
					getdata();
				}, 1000);
			}
			
			var page=1;
			function getdata(){
				var url='http://www.tngou.net/tnfs/api/list?page='+page+'&rows=15';
				mui.ajax(url,{
					/*data: JSON.stringify({
						page:2,
						rows:15
					}),*/
					dataType:'json',//服务器返回json格式数据
					type:'post',//HTTP请求类型
					timeout:10000,//超时时间设置为10秒；
					headers:{'Content-Type':'application/json'},	              
					success:function(mes){
						//服务器返回响应，根据响应结果，分析是否登录成功；
						var list=mes.tngou;
						count =list.length;
						var html="";
						for(var i=0;i<list.length;i++){
							var loan=list[i];
							html+='<li class="mui-table-view-cell"><center><img width="70%" height="70%" id="picBig" data-preview-src="" data-preview-group="1" src="http://tnfs.tngou.net/image'+loan.img+'"></img></center></li>'
							page++;
						}
						mui('#loanlist')[0].insertAdjacentHTML('beforeend', html);
										},
					error:function(xhr,type,errorThrown){
						//异常处理； 
						console.log(type);
					}
				});
			}
		</script>
	</body>

</html>